package cqrtplm.mapper;

import cqrtplm.entity.DeptRoleDO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.BaseMapper;

import java.math.BigInteger;
import java.util.List;

/**
 * @author 张宇
 */
@Repository
public interface DeptRoleMapper extends BaseMapper<DeptRoleDO> {
    @Select("SELECT DEPT_ID as deptId, DEPT_NAME as deptName, ROLE_NAME as roleName, ROLE_ID as roleId, " +
            "USER_NAME as userName, USER_ID as userId, OID as oid, USER_NO as userNo " +
            "FROM RT_DEPT_ROLE " +
            "WHERE DEPT_ID = #{oid}")
    List<DeptRoleDO> selectByDeptOid(@Param("oid") String oid);

    List<DeptRoleDO> selectByLeaderByDeptId(@Param("oid") String oid);
    /**
     * 根据用户所在部门id和领导的职级获取领导的信息
     */
    List<DeptRoleDO> selectLeaderByDeptIdAndRoleName(@Param("oid") String oid,@Param("roleName") String roleName);

    String selectParentOrgId(BigInteger oid);

    List<DeptRoleDO> selectDeptRoleDOListByDeptId(@Param("list") List<String> list);

}
